Skip to content

Add RSpec test suite with Rake task and CI workflow#6

Open
julioalucero wants to merge 6 commits into
mainfrom
add-test-suite
Open

Add RSpec test suite with Rake task and CI workflow#6
julioalucero wants to merge 6 commits into
mainfrom
add-test-suite

Conversation

@julioalucero

@julioalucero julioalucero commented Jul 16, 2026

Copy link
Copy Markdown
Member

Link to Jira

FR-740: Fix nofollow on internal links

Description

The gem had no tests, Rakefile, or CI right before the v0.2.0 release. This pins the current link rewriting behavior so the release and future changes are safe. No lib/ source changed, specs only lock existing behavior.

Note: specs were prompt-generated and then verified (full suite green, plus a sanity check that a deliberate bug makes them fail). Went this route to avoid spending manual time writing them out. If we consider that it is not worth it, or we don't want to work like this, we can safely close it.

  • Add spec/jekyll-external-link-accessibility_spec.rb covering host_for, external_link?, and modify_links (icon/span/target/title, external-only rel, skip rules, config overrides, existing-attr preservation)
  • Add spec/hooks_spec.rb that fires the real pages hook to confirm .html/.htm get rewritten and .xml/.json/.txt are skipped
  • Add spec/spec_helper.rb with a fake_page helper (two Structs standing in for a Jekyll page)
  • Add rspec + rake dev dependencies to the gemspec
  • Add Rakefile (rake runs the suite) and GitHub Actions CI across Ruby 2.7–4.0
  • Gemfile.lock picked up the dev deps and a stale 0.1.0 → 0.2.0 bump

QA steps

  1. bundle install
  2. bundle exec rspec, 17 examples, 0 failures
  3. bundle exec rake, same, via the default task

@julioalucero julioalucero self-assigned this Jul 16, 2026
Base automatically changed from release/v0.2.0 to main July 16, 2026 13:13
Comment thread .github/workflows/ci.yml Outdated
strategy:
fail-fast: false
matrix:
ruby: ['2.7', '3.0', '3.1', '3.2']

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@julioalucero Please add 3.3 through 4.0

@etagwerker etagwerker left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@julioalucero Also, please add a line to the CHANGELOG file

@julioalucero

Copy link
Copy Markdown
Member Author

@etagwerker done with it!

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces an initial automated test and CI setup for the jekyll-external-link-accessibility gem, aiming to lock in the current link-rewriting behavior prior to/around the v0.2.0 release so future changes can be made safely.

Changes:

  • Adds an RSpec test suite covering URL/host detection, external-link detection, link rewriting behavior, and the Jekyll :pages, :post_render hook behavior.
  • Adds a Rakefile to run the specs via rake, plus RSpec/Rake development dependencies.
  • Adds a GitHub Actions CI workflow to run the test suite across a Ruby version matrix, and updates lockfile/changelog accordingly.

Reviewed changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
spec/spec_helper.rb Adds RSpec configuration and a Jekyll page test double helper.
spec/jekyll-external-link-accessibility_spec.rb Adds unit-style coverage for host parsing, external link detection, and HTML rewriting output.
spec/hooks_spec.rb Adds a hook-level spec verifying rewrites only happen for .html/.htm pages.
Rakefile Adds a default rake task to run the RSpec suite.
jekyll-external-link-accessibility.gemspec Adds rspec and rake as development dependencies.
Gemfile.lock Locks the new dev dependencies and updates the local gem version reference.
CHANGELOG.md Records the new test/CI addition in the unreleased section.
.rspec Configures RSpec to require spec_helper and sets output formatting.
.github/workflows/ci.yml Adds CI workflow running bundle exec rake across a Ruby matrix.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread spec/spec_helper.rb Outdated
Comment thread spec/hooks_spec.rb Outdated
Comment thread .github/workflows/ci.yml
Comment thread jekyll-external-link-accessibility.gemspec
etagwerker and others added 4 commits July 16, 2026 14:00
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@julioalucero

Copy link
Copy Markdown
Member Author

@etagwerker fixed the CI, Gemfile.lock was not updated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants